package demo.android.com.mvpdemo.mvp3;

import demo.android.com.mvpdemo.mvp3.base.BasePresenter;
import demo.android.com.mvpdemo.retrofit.BaseSubscriber;

/**
 * Created by Vya on 2018/1/11 0011.
 */
//BasePresenter<UserInfoContract.UserInfoView,UserInfoModel> implements UserInfoContract.UserInfoPresenter
public class FragmentShowPresenter extends BasePresenter<FragmentContract.UserInfoView,FragmentModel>
        implements FragmentContract.FragmentPresenter{
    @Override
    public void show(String str) {
        //使用网络引擎获取数据
        getView().onLoading();

        getModel().setShow("--thisFragmentShowPresenter---").subscribe(new BaseSubscriber<String>() {
            @Override
            protected void onError(String errorCode, String errorMessage) {
                getView().onError();
            }

            @Override
            public void onNext(String userInfo) {
                getView().onSucceed(userInfo);
            }
        });
    }
}
